#pragma once

#include <memory>
#include <chrono>
#include <string>
#include <boost/make_shared.hpp>
#include <vector>
#include <cmath>
#include "rclcpp/rclcpp.hpp"
//#include "std_msgs/msg/string.hpp"
#include <sensor_msgs/msg/laser_scan.hpp>
#include "sensor_msgs/msg/point_cloud2.hpp"

#include "sensor_msgs/msg/imu.hpp"
#include "std_msgs/msg/header.hpp"

#include <pcl/point_cloud.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
//#include <pcl_ros/point_cloud.h>
#include <pcl_conversions/pcl_conversions.h>
#include <pcl/common/common.h>
#include <pcl/common/transforms.h>
#include <pcl/filters/voxel_grid.h>
//#include <pcl/octree/octree.h>
#include <pcl/kdtree/kdtree_flann.h>
//#include <pcl/registration/icp.h>
//#include <pcl/features/normal_3d.h>

// Eigen
#include <Eigen/Core>
#include <Eigen/Eigen>
#include <Eigen/Geometry>
/// @brief 
struct scan_data
{
    double angle;
    double distance;     
};
struct Angle_Index_struct
{
   int index;
   int attribute;  //阴阳角属性 -1 或1 0未定义
   double angle;  //
   double distance;
};
class Scan_cloud
{
    public:
    Scan_cloud(){
      angle_cloud = std::make_shared<pcl::PointCloud<pcl::PointXYZ>>(); // 使用 make_shared 创建并赋值;

    };
    ~Scan_cloud(){};
    void set_scan_input(sensor_msgs::msg::LaserScan::SharedPtr scan);
    void convert_to_cloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_);
    void find_angle_point(void);
    double calculate_variance(std::vector<double> &db);
   // private:
         std::vector <scan_data> old_scan;
         std::vector <scan_data> receive_scan;
         std::vector <scan_data> angle_scan;
         pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_p;
         pcl::PointCloud<pcl::PointXYZ>::Ptr angle_cloud;
         std::vector <Angle_Index_struct> angle_index;
       //  std::vector<int> angle_attribute; //角属性
         
           std::vector<int>* index_;
        
};


